//
//  NYMeViewController.m
//  百思不得姐
//
//  Created by Apple on 15/8/22.
//  Copyright (c) 2015年 Neal. All rights reserved.
//

#import "NYMeViewController.h"
#import "NYMeCell.h"
#import "NYSquareView.h"
#import <UIImageView+WebCache.h>
#import "NYSettingViewController.h"

@interface NYMeViewController ()

@end

@implementation NYMeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupnavBarButtonItem];
    [self setuptableView];
    [self setuptableFooterView];
    
}
- (void)setupnavBarButtonItem
{
    UIBarButtonItem *seeting = [UIBarButtonItem itemWithTarget:self action:@selector(setting) image:[UIImage imageNamed:@"mine-setting-icon"] Highlightedimage:[UIImage imageNamed:@"mine-setting-icon-click"]];
    UIBarButtonItem *moon = [UIBarButtonItem itemWithTarget:self action:@selector(moon) image:[UIImage imageNamed:@"mine-moon-icon"] Highlightedimage:[UIImage imageNamed:@"mine-moon-icon-click"]];
    self.navigationItem.rightBarButtonItems = @[seeting,moon];
}
- (void)setting
{
    NYSettingViewController *settingvc = [[NYSettingViewController alloc]initWithStyle:UITableViewStyleGrouped];
    [self.navigationController pushViewController:settingvc animated:YES];
}
- (void)moon
{
}
- (void)setuptableView
{
    self.automaticallyAdjustsScrollViewInsets = YES;
    self.tableView.contentInset = UIEdgeInsetsMake(Margin - 35 , 0, 0, 0);
    self.tableView.sectionHeaderHeight = 0;
    self.tableView.sectionFooterHeight = Margin;
}
- (void)setuptableFooterView
{
    NYSquareView *footerview = [[NYSquareView alloc]init];
    self.tableView.tableFooterView = footerview;
}

#pragma mark - tableview数据源方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *ID = @"MeCell";
    NYMeCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[NYMeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    if (indexPath.section == 0) {
        cell.textLabel.text = @"登陆/注册";
        cell.imageView.image = [UIImage imageNamed:@"mine_icon_nearby"];
    } else {
        cell.textLabel.text = @"离线下载";
    }
    return cell;
}

#pragma mark - tableview代理方法

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}
@end
